// 云函数入口文件
const cloud = require('wx-server-sdk')

const getOpenId = require('./getOpenId/index');
const insertRecord = require('./insertRecord/index');
const selectRecord = require('./selectRecord/index');
const updateRecord = require('./upadteRecord/index');

cloud.init({
    env: cloud.DYNAMIC_CURRENT_ENV
})

// 云函数入口函数
exports.main = async (event, context) => {
    switch (event.type) {
        case 'getOpenId':
            return await getOpenId.main(event, context);
        case 'insertRecord':
            return await insertRecord.main(event, context);
        case 'selectRecord':
            return await selectRecord.main(event, context);
        case 'updateRecord':
            return await updateRecord.main(event, context);
    }
}